<template>
  <div class="app-getgood">
    <!-- <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="查询商品详情">
        <el-input
          v-model="formInline.user"
          placeholder="查询商品详情"
        ></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>
    <div class="create" v-if="flag">
      <el-form ref="user" :model="user" label-width="80px">
        <el-form-item label="商品图片">
          <el-upload
            class="avatar-uploader"
            action="http://lanlianhua.work:8888/api/v1/common/file_upload"
            :show-file-list="false"
            :on-success="handleAvatarSuccess"
          >
            <img width="80px" v-if="imageUrl" :src="imageUrl" class="avatar" />
          </el-upload>
        </el-form-item>
      </el-form>

      <el-dialog :visible.sync="dialogVisible">
        <img width="100%" :src="imageUrl" alt="" />
      </el-dialog>
      <el-form ref="form" :model="form" label-width="80px">
        <el-form-item label="商品名字">
          <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="数量(库存)">
          <el-input v-model="form.quantity"></el-input>
        </el-form-item>
        <el-form-item label="内容">
          <el-input v-model="form.content"></el-input>
        </el-form-item>
        <el-form-item label="价格">
          <el-input v-model="form.price"></el-input>
        </el-form-item>
      </el-form> -->
    <!-- </div> -->
  </div>
</template>

<script>
// import { getgoods, getgood } from "@/api/address";

// export default {
//   name: "UserList",
//   components: {},
//   data() {
//     return {
//       tableData: [],
//       tableData1: [],
//       dialogVisible: false,
//       flag: false,
//       id: "",
//       imageUrl: "",
//       formInline: {
//         user: "",
//       },
//       user: {
//         name: "",
//       },
//       form: {
//         name: "",
//         descriptions: "",
//         quantity: "",
//         content: "",
//         price: "",
//         coverImg: "",
//         region: "",
//         date1: "",
//         date2: "",
//         delivery: false,
//         type: [],
//         resource: "",
//         desc: "",
//       },
//     };
//   },

//   created() {
// this.id = this.$route.query.id;
// this.initaddress();
// },
// methods: {
//   async initaddress() {
//     const result1 = await getgood(this.id);
//     console.log(1112, result1);
//     this.form.name = result1.name;
//     this.form.quantity = result1.quantity;
//     this.form.price = result1.price;
//     this.form.content = result1.content;
//     this.imageUrl = result1.coverImg;
//     if (result1) {
//       this.flag = "true";
//     }
//   console.log(this.tableData);
// },
// 处理图片
// async onSubmit() {
//   this.flag = false;
//   console.log("submit!");
//   const result = await getgoods(400, 1);
//   console.log(111, result, this.formInline.user);
//   this.tableData1 = result.products;
//   this.tableData1.forEach((item) => {
//     if (item.name == this.formInline.user) {
// const result1 = await getaddress(item._id);
//       this.id = item._id;

//       this.initaddress();
//       console.log(this.id);
//     }
//   });
// },
// handleAvatarSuccess(res, file) {
//   console.log(res);
//   console.log(file);
//   this.coverImg = "http://lanlianhua.work:8888" + res.info;
// },
// 弹出修改弹框
//   },
// };
//
</script>

<style scoped>
.edit-input {
  padding-right: 100px;
}
.cancel-btn {
  position: absolute;
  right: 15px;
  top: 10px;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>
